// 这里只是注册接口
const Router = require('koa-router')
const {
    create,
    login,
    edit,
    getList,
    deleteUser
} = require('../controller/user.controller')

const {
    verifyRegister,
    verifyLogin,
    verifyEdit,
    verifyList,
    verifyDelete
} = require('../middleware/user.middleware')

const userRouter = new Router({prefix: '/users'})

userRouter.post('/login', verifyLogin, login)

userRouter.post('/register', verifyRegister, create)

userRouter.get('/list', verifyList, getList)
// 更新、假删除
userRouter.post('/delete', verifyDelete, deleteUser)

userRouter.post('/edit', verifyEdit, edit)

module.exports = userRouter
